import com.zhang.pojo.MyDataSource;
import com.zhang.service.UserService;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class testAutowire {
    @Test
    public void testAutowireByName() {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("Autowire.xml");
        UserService userService = applicationContext.getBean("userService2", UserService.class);
        userService.show();
    }

    @Test
    public void test_out_prop() {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("bean_out_prop.xml");

        MyDataSource myDataSource = applicationContext.getBean("myDataSource", MyDataSource.class);
        System.out.println(myDataSource.toString());

    }

}
